
#include<iostream>
#include<math.h>
using namespace std;
int main(){
	unsigned long term=1;
	double e=1.0,fac;
	int n=1,count=1;
	while(fabs(fac)>=1e-5){
		for(int i=1;i<=n;i++)
		  term=term*i;
		fac=1.0/term;
		e=e+fac;
		n++;
		count++;
		}
	cout<<"n="<<n<<","<<"e="<<e<<endl;
	return 0;
	}